const router = require('koa-router')() // 一边导入一边实例化
// 操作数据库的接口
const { getToken, Deleteurl } = require('../../config/databaseapi.js')
// 注册接口
router.post('/deleteannouncement', async (ctx) => {
    console.log('调用删除公告信息接口');
    const { _id } = ctx.request.body;
    console.log(ctx.request.body);
    const query = `db.collection("announcement").where({_id:"${_id}"}).remove()`;
    const res = await new getToken().posteve(Deleteurl, query);
    if (res.errcode === 0) {
        ctx.body = { msg: "删除成功", status: 1 };
    } else {
        ctx.body = { msg: "删除失败", status: 0 };
    }
})

module.exports = router.routes();